<?php

namespace Syrius\Keys;

/**
 * Enter description here ...
 * @package	Keys
 * @author	Domenico Biancardi <domenico.biancardi@gmail.com>
 * @link	http://code.google.com/p/syrius/
 *
 */ class ForeignKey extends Keys {
	public function addCondition($table = "", $source = "", $field = "") {
		$this->_source = $source;
		$this->_field = $field;
		$this->addConstraint("frk_" . $table . "_" . $source);
	}

	/**
	 * Ritorna la rappresentazione della chiave
	 */
	public function __toString() {
		$str = parent::__toString();
		$str .= " FOREIGN KEY (`" . $this->indexColName [0] . "`) REFERENCES " . $this->_source . "(`" . $this->_field [0] . "`)";
		return $str;
	}

	private $_source;

	private $_field;

}

?>
